/**
 @defgroup ACUAS_EPuart ACUAS Easy Programming UART
 @code #include "ACUASUART.h" @endcode
 @brief C macros to easily program UART of the ACUAS ATmega16/ATmega32 board. 
 @author Thomas Siepmann, Aachen University of Applied Sciences, Germany. Based on the UART library of Peter Fleury http://jump.to/fleury
 @see http://www.siepmann.fh-aachen.de
*/

#include <avr/interrupt.h>
//#include <avr/signal.h>
#include <avr/pgmspace.h>
#include "UART\uart.h"
#include "UART\uart.c"

/*@{*/
char uart_str[21]; // used by UART_NUMBER
/// Initialises the UART. Must be invoked in the PROGRAM_INIT part
#define INIT_UART {uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) ); sei();}
/// Sends a string over UART
#define UART_TEXT(string) uart_puts(string);
/// Sends a number over UART
#define UART_NUMBER(x) {itoa( x, uart_str, 10); uart_puts(uart_str);}
/// Sends one character over UART
#define UART_CHAR(c) uart_putc(c);
/// Sends a linefeed over UART
#define UART_CRLF uart_putc(13);
/// Reads one character from UART
#define UART_READ_CHAR(c) c = uart_getc();
/// 
/**
 *  @brief   Reads one line of text delimeted by a carriage return (ASCII 13). The function waits until a carriage return is received or max_char characters have been received
 *  @param   c_array a char-array which can contain at least max_char characters + 1
 *  @param   max_char the maximum amount of characters which are received if no carriage return is received.
 *  @return  none
 */
#define UART_READ_LINE(c_array,max_char) uart_read_line((c_array), (max_char));

// FUNCTIONS
#include "ACUASUART.c"

/*@}*/
